home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
utils
/
unix
/
unzip-5.12
/
unzip.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-22
|
60KB
|
1,803 lines
/*---------------------------------------------------------------------------
unzip.h
This header file is used by all of the UnZip source files. Its contents
are divided into seven more-or-less separate sections: predefined macros,
OS-dependent includes, (mostly) OS-independent defines, typedefs, function
prototypes (or "forward declarations," in the case of non-ANSI compilers),
macros, and global-variable declarations.
---------------------------------------------------------------------------*/
#ifndef __unzip_h /* prevent multiple inclusions */
#define __unzip_h
/*****************************************/
/* Predefined, Machine-specific Macros */
/*****************************************/
#if defined(__GO32__) && defined(unix) /* MS-DOS extender: NOT Unix */
# undef unix
#endif
#if (defined(__convex__) && !defined(__convexc__))
# define __convexc__
#endif
#if defined(unix) || defined(M_XENIX) || defined(COHERENT) || defined(__hpux)
# ifndef UNIX
# define UNIX
# endif
#endif /* unix || M_XENIX || COHERENT || __hpux */
#if defined(__convexc__) || defined(MINIX)
# ifndef UNIX
# define UNIX
# endif
#endif /* __convexc__ || MINIX */
#ifdef __COMPILER_KCC__
# include <c-env.h>
# ifdef SYS_T20
# define TOPS20
# endif
#endif /* __COMPILER_KCC__ */
/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
#ifdef __POWERC
# define __TURBOC__
# define MSDOS
#endif /* __POWERC */
#if defined(__MSDOS__) && (!defined(MSDOS)) /* just to make sure */
# define MSDOS
#endif
#if defined(linux) && (!defined(LINUX))
# define LINUX
#endif
/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C, or
* Silicon Graphics, or Convex?, or IBM C Set/2, or GNU gcc/emx, or Watcom C,
* or Macintosh, or Windows NT, or Sequent, or Atari.
*/
#if defined(__STDC__) || defined(MSDOS) || defined(sgi)
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__)
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if defined(THINK_C) || defined(MPW) || defined(WIN32) || defined(_SEQUENT_)
# ifndef PTX /* Sequent running Dynix/ptx: non-modern compiler */
# ifndef PROTO
# define PROTO
# endif
# define MODERN
# endif
#endif
#if defined(ATARI_ST) || defined(__BORLANDC__) /* || defined(__convexc__) */
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
/* turn off prototypes if requested */
#if defined(NOPROTO) && defined(PROTO)
# undef PROTO
#endif
/* used to remove arguments in function prototypes for non-ANSI C */
#ifdef PROTO
# define OF(a) a
#else
# define OF(a) ()
#endif
/* bad or (occasionally?) missing stddef.h: */
#if defined(M_XENIX) || defined(DNIX)
# define NO_STDDEF_H
#endif
#if defined(apollo) /* defines __STDC__ */
# define NO_STDLIB_H
#endif /* apollo */
#ifdef DNIX
# define SYSV
# define SHORT_NAMES /* 14-char limitation on path components */
/* # define FILENAME_MAX 14 */
# define FILENAME_MAX NAME_MAX /* GRR: experiment */
#endif
#if (defined(__SYSTEM_FIVE) || defined(M_SYSV) || defined(M_SYS5))
# ifndef SYSV
# define SYSV
# endif
#endif /* __SYSTEM_FIVE || M_SYSV || M_SYS5 */
#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr))
# if (!defined(BSD) && !defined(SYSV))
# define BSD
# endif
#endif /* ultrix || bsd4_2 || sun || pyr */
#if defined(__convexc__)
# if (!defined(BSD) && !defined(SYSV))
# define BSD
# endif
#endif /* __convexc__ */
#ifdef pyr /* Pyramid */
# ifdef BSD
# define pyr_bsd
# define USE_STRINGS_H /* instead of more common string.h */
# endif
# define ZMEM /* should ZMEM only be for BSD universe...? */
# define DECLARE_ERRNO /* (AT&T memcpy was claimed to be very slow) */
#endif /* pyr */
#if (defined(CRAY) && defined(ZMEM))
# undef ZMEM
#endif
/* stat() bug for Borland, Watcom, VAX C (also GNU?), and Atari ST MiNT on
* TOS filesystems: returns 0 for wildcards! (returns 0xffffffff on Minix
* filesystem or U: drive under Atari MiNT) */
#if (defined(__TURBOC__) || defined(__WATCOMC__) || defined(VMS))
# define WILD_STAT_BUG
#endif
#if (defined(__MINT__))
# define WILD_STAT_BUG
#endif
#ifdef WILD_STAT_BUG
# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
#else
# define SSTAT stat
#endif
#ifdef REGULUS /* returns the inode number on success(!)...argh argh argh */
# define stat(p,s) zstat(p,s)
#endif
#define STRNICMP zstrnicmp
/***************************/
/* OS-Dependent Includes */
/***************************/
#ifndef MINIX /* Minix needs it after all the other includes (?) */
# include <stdio.h>
#endif
#include <ctype.h> /* skip for VMS, to use tolower() function? */
#include <errno.h> /* used in mapname() */
#ifdef USE_STRINGS_H
# include <strings.h> /* strcpy, strcmp, memcpy, index/rindex, etc. */
#else
# include <string.h> /* strcpy, strcmp, memcpy, strchr/strrchr, etc. */
#endif
#ifdef MODERN
# include <limits.h> /* GRR: EXPERIMENTAL! (can be deleted) */
#endif
#ifdef EFT
# define LONGINT off_t /* Amdahl UTS nonsense ("extended file types") */
#else
# define LONGINT long
#endif
#ifdef MODERN
# ifndef NO_STDDEF_H
# include <stddef.h>
# endif
# ifndef NO_STDLIB_H
# include <stdlib.h> /* standard library prototypes, malloc(), etc. */
# endif
typedef size_t extent;
typedef void voidp;
#else /* !MODERN */
LONGINT lseek();
# ifdef VAXC /* not fully modern, but does have stdlib.h */
# include <stdlib.h>
# else
char *malloc();
# endif
typedef unsigned int extent;
typedef char voidp;
# define void int
#endif /* ?MODERN */
/* this include must be down here for SysV.4, for some reason... */
#include <signal.h> /* used in unzip.c, file_io.c */
/*---------------------------------------------------------------------------
Amiga section:
---------------------------------------------------------------------------*/
#ifdef AMIGA
# include "amiga/amiga.h"
# ifndef AZTEC_C
# include <sys/types.h> /* off_t, time_t, dev_t, ... */
# include <sys/stat.h>
# endif
# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
# define DATE_FORMAT DF_MDY
# define lenEOL 1
# define PutNativeEOL *q++ = native(LF);
/* # define USE_FWRITE if write() returns 16-bit int */
# define PIPE_ERROR (errno == 9999) /* always false */
#endif
/*---------------------------------------------------------------------------
Atari ST section:
---------------------------------------------------------------------------*/
#if (defined(ATARI_ST) || defined(__MINT__)) /* comments by [cjh] */
# ifdef __TURBOC__
# include <ext.h> /* stat() */
# include <tos.h> /* OS-specific functions (Fdup) */
# endif
# include <time.h>
# ifndef __MINT__
# define dup Fdup
# define mkdir Dcreate
# define DIR_END '\\'
# else
# include <sys/types.h> /* didn't we include this already? */
# include <sys/stat.h>
# include <fcntl.h> /* O_BINARY */
# include <unistd.h> /* dup proto & unix system calls live here */
# include <time.h>
# include <stdio.h> /* didn't we include this already? */
# define dup dup
# define mkdir mkdir
# define DIR_END '/' /* much sexier than DOS filenames... */
# define timezone _timezone /* oops */
# define DIRENT
# define SYMLINKS
# ifdef S_ISLNK /* WARNING: horrible kludge!!!! */
# undef S_ISLNK /* MiNTlibs & POSIX don't define S_ISLNK */
# define S_ISLNK(a) (((a) & 0xa000) == 0xa000)
# endif
# ifdef SHORT_NAMES /* library will truncate weird names on TOS fs */
# undef SHORT_NAMES
# endif
# ifndef ZMEM
# define ZMEM /* we have bcopy, etc., ifndef __STRICT_ANSI__ */
# endif
# endif /* __MINT__ */
# ifndef S_IFMT
# define S_IFMT (S_IFCHR | S_IFREG | S_IFDIR)
# endif
# define DATE_FORMAT DF_MDY
# ifndef lenEOL
# define lenEOL 2 /* DOS convention; MiNT doesn't